#include<stdio.h>

int main()
{
	char c;
	int m , p ,q,h; 
     while ((c = getchar()) != '\n') 
	 {
		if((c >= 'a'&&c <='z')||(c >='A'&& c <='Z')) 
		    m++;
		 else if(c >=0|| c<=9)
		       p++;
		 else if(c ==' ')
		      q++;
		 else
		      h++;
		
	 }  
	printf("%d\n%d\n%d\n%d",m,p,q,h);
	
	return 0;
 } 
